﻿Partial Public Class InvCountExplorer
    Public Overridable Sub ProcessCurrentMasterRecord(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs)
        Throw New NotImplementedException
    End Sub
    Public Overridable Sub ValidateMasterRow(sender As Object, e As Views.Base.ValidateRowEventArgs)
        Throw New NotImplementedException
    End Sub

    Public Overridable Sub ValidateDetailRow(sender As Object, e As Views.Base.ValidateRowEventArgs)
        Throw New NotImplementedException
    End Sub

    Public Overridable Sub InitNewMasterRow(sender As Object, e As InitNewRowEventArgs)
        Dim view As GridView = CType(sender, GridView)
        Dim row As DataRow = view.GetFocusedDataRow()
        Using InvcountHeader As SystemBoxSDK.PL.INVSDK.InvCountHeader_PL = New SystemBoxSDK.PL.INVSDK.InvCountHeader_PL()

            InvcountHeader.NewRecord(row)
        End Using

    End Sub

    Public Overridable Sub CustomRowCellEditForEditing(ByVal sender As Object, ByVal e As CustomRowCellEditEventArgs)
        Throw New NotImplementedException
    End Sub

    Public Overridable Sub InitNewDetailRow(sender As Object, e As InitNewRowEventArgs)
        Throw New NotImplementedException
    End Sub

    Public Overridable Sub ProcessCurrentDetailRecord(sender As Object, e As Views.Base.ValidateRowEventArgs, index As Integer)
        Throw New NotImplementedException
    End Sub

    Public Overridable Sub DetailCellValueChanged(sender As Object, e As Views.Base.CellValueChangedEventArgs)
        Throw New NotImplementedException
    End Sub

    Public Overridable Sub MasterRowClick(sender As Object, e As RowClickEventArgs)
        Throw New NotImplementedException
    End Sub

    Public Overridable Sub DetailRowClick(sender As Object, e As RowClickEventArgs)
        Throw New NotImplementedException
    End Sub

    Public Overridable Sub DetailCustomRowCellEditForEditing(sender As Object, e As CustomRowCellEditEventArgs)
        Throw New NotImplementedException
    End Sub


    ''' <summary>
    ''' GenerateInventorySheet
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub GenerateInventorySheet(ByVal sender As Object, ByVal e As EventArgs)
        Me.Cursor = Cursors.WaitCursor
        Dim sqlcmd As System.Data.SqlClient.SqlCommand = Nothing
        Dim aDataRow As DataRow = CType(CType(sender, DXMenuItem).Tag, DataRow)
        Dim countID As Guid = aDataRow("")

        Try
            If NodeDataRow IsNot Nothing Then
                INVSDK.InvCountHeader_PL.GenerateInventorySheet(countID)
            End If

        Catch ex As Exception
            MessageWindow.ShowMessage(ex)
        Finally
            If sqlcmd IsNot Nothing Then
                sqlcmd.Dispose()
            End If
        End Try




        Me.Cursor = Cursors.Default
    End Sub

    ''' <summary>
    ''' GenerateInventoryBatch
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub GenerateInventoryBatch(ByVal sender As Object, ByVal e As EventArgs)
        Me.Cursor = Cursors.WaitCursor
        Dim aDataRow As DataRow = CType(CType(sender, DXMenuItem).Tag, DataRow)
        Dim countID As Guid = aDataRow("")
        Try
            INVSDK.InvCountHeader_PL.GenerateInventoryBatch(countID)
        Catch ex As Exception
            MessageWindow.ShowMessage(ex.Message, MsgBoxStyle.Information)
        End Try
        Me.Cursor = Cursors.Default
    End Sub



    ''' <summary>
    ''' GenerateInventorySheetWSvc
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub GenerateInventorySheetWSvc(ByVal sender As Object, ByVal e As EventArgs)
        Me.Cursor = Cursors.WaitCursor
        Dim SysBoxSvc As SystemBoxWSvc = New SystemBoxWSvc()
        Dim aDataRow As DataRow = CType(CType(sender, DXMenuItem).Tag, DataRow)
        Try
            'TestPoint: sqlcmd = MetaQuery.GetSPCmdByMetaName("InsertInvCountDetails")
            SysBoxSvc.GenerateInventorySheet(aDataRow)
        Catch ex As Exception
            MessageWindow.ShowMessage(ex.Message, MsgBoxStyle.Information)
        End Try


        Me.Cursor = Cursors.Default
    End Sub

    ''' <summary>
    ''' GenerateInventoryBatchWSvc
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub GenerateInventoryBatchWSvc(ByVal sender As Object, ByVal e As EventArgs)
        Me.Cursor = Cursors.WaitCursor
        Dim SysBoxSvc As SystemBoxWSvc = New SystemBoxWSvc()
        Dim aDataRow As DataRow = CType(CType(sender, DXMenuItem).Tag, DataRow)
        Try
            SysBoxSvc.GenerateInventoryBatch(aDataRow)
        Catch ex As Exception
            MessageWindow.ShowMessage(ex.Message, MsgBoxStyle.Information)
        End Try
        Me.Cursor = Cursors.Default
    End Sub

End Class
